<include file="Common:header" />
<TYimport plugin='datepicker' />
<TYjs file='fix_table_title'/>
<TYjs file='init'/>

<div class="table_content">
    <form action="{:U(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME)}" method="post" class="ajax_form">
        <div class="toolbar">
        	<select id="select_orders_status" name="search">
        		<option value="0">全部</option>
        		<option value="1">待制作(有视频素材)</option>
                <option value="2">制作中</option>
                <option value="3">已制作</option>
        	</select>
            <select id="select_orders" name="order_find">
                <option value="0">订单号</option>
        		<option value="1">手机号</option>
        	</select>
            <!-- 请填订单号 -->
            <input type="text" class="text w150" name="keywords"  title="请填订单号" placeholder="请填订单号"/>
            <!-- 查询 -->
            <button type="submit">查询</button>
        </div>
    </form>

        <table class="orders_table">
            <tr>
                <th width="10%">预定项目</th>
                <th width="6%">预定城市</th>
                <th width="6%">所在医院</th>
                <th width="6%">住院编号</th>
                <th width="6%">联系人</th>
                <th width="6%">联系人(手机号)</th>
                <th width="11%">预定时间</th>
                <th width="6%">视频进度</th>
                <th width="6%">订单状态</th>
            </tr>

            <foreach name='orderList' item='vo' key="k">
                <tr>
                	<td class="bgce1" colspan="9">
                        <span style="float: left;padding-left: 5%;">
                            訂單號：<span style="color:#ff8800">{$vo.ordersn}</span>
                        </span>
                        <span style="float: right;padding-right: 5%;">
                            <a href="{:U(MODULE_NAME.'/Orders/order_details',array('id'=>$vo['order_id']))}">查看詳情</a>
                        </span>
                    </td>
                </tr>
                <tr>
                	<td class="txtc">{$vo.project_name}</td>
                	<td class="txtc">{$vo.province_name} {$vo.city_name}</td>
                	<td class="txtc">
                		{$vo.hospital_name}
                	</td>
                    <td class="txtc">
                        {$vo.hospitalno}
                    </td>
                    <td class="txtc">
                        {$vo.parents_name}
                    </td>
                    <td class="txtc">
                        {$vo.parents_phone}
                    </td>
                	<td class="txtc">{$vo.o_create_time|date="Y-m-d H:i:s",###}</td>
                    <td class="txtc">
                        <switch name="vo['is_make']">
                                <case value="2">
                                    <p style="color: green;">制作完成</p>
                                </case>
                                <case value="1">
                                    <p style="color: #FF6688;">制作中</p>
                                </case>
                                <case value="0">
                                    <p style="color: red;">待制作</p>
                                    <button class="startMake" order_id="{$vo['order_id']}">开始制作</button>
                                </case>
                                <default>非法操作
                        </switch>
                    </td>
					<td class="txtc">
                        <switch name="vo['is_pay']">
                            <case value="1"><p style="color: green;">已付款</p></case>
                            <case value="0"><p style="color: red;">待付款</p></case>
                            <default>非法操作
                        </switch>
                	</td>
                </tr>
                <tr style="height:10px;" >
                	<td class="bgcf5"colspan="9"></td>
                </tr>
            </foreach>
        </table>
    <div class="page">{$page}</div>
</div>

<include file="Common:footer" />
<script type="text/javascript">

 $('.startMake').click(function(){
     var id = $(this).attr('order_id');
	 var url = "{:U(MODULE_NAME.'/'.CONTROLLER_NAME.'/startMake')}";
	 var type = "post";
  	 var dataType = "JSON";
  	 var async = "true";
  	    $.ajax({
 			url: url,
 			type: type,
 			dataType: dataType,
 			data:{id : id},
 			async: async,
 	    	success: function (data) {
 	    		if (data.status == 1){
 	    			callBackTips(data.status, data.info,data.url);
 	    		}else{
 	    			callBackTips(data.status, data.info,data.url);
 	    		}
 	    	}
        });
 });

<foreach name='orderList' item='vo' key="k">
	$('.select_{$k}').click(function(){
		art.dialog({
			content: document.getElementById('add_name_{$k}'),
		});
	});


	$('input[name=confirm_select_{$k}]').click(function(){
	 		var staff_id = '';
			$('input[name=checkbox_{$k}]').each(function(){
				if($(this).prop('checked')){
					staff_id = $(this).attr('staff_id') + ',' + staff_id;
				}
			});
			$('.staff_id_{$k}').val(staff_id);
			$('.ordersn_{$k}').val($(this).attr('ordersn'));
			/* alert($('input[name=ordersn]').val());return; */
			var formData = new FormData($( "#upForm_{$k}" )[0]);
		$.ajax({
	        url: "{:U(MODULE_NAME.'/'.CONTROLLER_NAME.'/select_washer')}" ,
	        type: 'POST',
	        data : formData,
	        async: false,
	        cache: false,
	        contentType: false,
	        processData: false,
	        success: function (returndata) {
	       		if(returndata.status){
	       			callBackTips(returndata.status,returndata.info,returndata.url);
	    		}else{
	    			callBackTips(0,returndata.info);
	    		}
	        },
	   });
	});
</foreach>

</script>
